package com.azdebugit.list.arraylist.test;

public class ArrayCopy {
    public static void main(String[] args) {

        char[] arr1 = new char[]{'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k'};
        char[] arr2 = new char[]{'r', 't', 'y', 'u', 'o'};
        printArray(arr1);//先打印arr1方法
        printArray(arr2);//打印arr2方法
        System.arraycopy(arr2, 1, arr1, 0, 3);//调用copy方法
        printArray(arr1);//重新打印arr1方法
    }

    //打印数组方法
    public static void printArray(char[] arr1) {
        for (int i = 0; i < arr1.length; i++) {
            System.out.print(arr1[i] + "\t");
        }
        System.out.println();
    }
}
